/*
 * @Author: zhangzhen
 * @Date: 2022-12-30 09:12:30
 * @LastEditors: zhangzhen
 * @LastEditTime: 2023-02-28 16:47:08
 *
 */
import React, {FC, useState, useRef} from 'react';
import FormDesign, {FormDesignRefType} from './FormDesign';
import {Button, message} from 'antd';
import { useNavigate,useLocation } from 'react-router-dom';



const FormPage: FC<any> = () => {
    const FormDesignRef = useRef<FormDesignRefType>(null);
    const navigate = useNavigate()
    const {state} = useLocation()
    const {fieldList,layout:layoutInfo} =state||{}
    return (
        <div style={{height: '100%'}}>
               <div
                style={{
                    zIndex: 3,
                    position: 'absolute',
                    padding: 5,
                    top: 0,
                    right: 10,
                    display: 'flex',
                    justifyContent: 'space-between',
                    background: 'rgba(0,0,0,0.7)',
                }}>
              
                <Button
                    onClick={() => {
                        navigate("/use",{state:{}})
                    }}>
                    FormUse
                </Button>
            </div>
            <FormDesign
                ref={FormDesignRef}
                isEdit={true}
                defaultValue={fieldList||[]}
                defaultLayout={layoutInfo}
                
            />
        </div>
    );
};

export default FormPage;
